import React, { Component } from 'react'

export default class App extends Component {
  state = { count: 100 }
  componentDidMount () {}
  render() {
    return (
      <div>
        <button onClick = { () => {
          // this.setState({
          //   count: this.state.count - 10
          // })
          this.setState((prevState) => ({
            count: prevState.count - 10
          }))
        } }>-</button>
        { this.state.count }
        <button onClick = { () => {
          this.setState({
            count: this.state.count + 10
          })
        } }>+</button>
      </div>
    )
  }
}
